#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=5e5+5,inf=1e9;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch-getchar();}
    while(isdigit(ch)){x=(x<<1)+(x<<3)+ch-48,ch=getchar();}
    return x*f;
}
int n,m,x,A,B,ans=inf;
vector<int> e[N];
int a[N],pos[N];

#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)

struct Seg2{
    int t[N<<2],laz[N<<2];

    inline void pushup(int x){
        t[x]=min(t[ls],t[rs]);
    }
    void build(int x,int l,int r){
        laz[x]=0;
        if(l==r){
            t[x]=a[l];
            return;
        }
        build(ls,l,mid);
        build(rs,mid+1,r);
        pushup(x);
    }
    inline void down(int x,int k){
        t[x]+=k;
        laz[x]+=k;
    }
    inline void pushdown(int x){
        if(laz[x]==0) return;
        down(ls,laz[x]);
        down(rs,laz[x]);
        laz[x]=0;
    }
    void update(int x,int l,int r,int L,int R,int k){
        if(l>=L&&r<=R){
            down(x,k);
            return;
        }
        pushdown(x);
        if(L<=mid) update(ls,l,mid,L,R,k);
        if(R>mid) update(rs,mid+1,r,L,R,k);
        pushup(x);
    }
    void modify(int x,int l,int r,int p,int k){
        if(l==r){
            t[x]=k;
            return;
        }
        pushdown(x);
        if(p<=mid) modify(ls,l,mid,p,k);
        else modify(rs,mid+1,r,p,k);
        pushup(x);
    }    
    void chmin(int x,int l,int r,int p,int k){
        if(l==r){
            t[x]=min(t[x],k);
            return;
        }
        pushdown(x);
        if(p<=mid) chmin(ls,l,mid,p,k);
        else chmin(rs,mid+1,r,p,k);
        pushup(x);
    }
    int query(int x,int l,int r,int L,int R){
        if(l>=L&&r<=R) return t[x];
        pushdown(x);
        int res=inf;
        if(L<=mid) res=min(res,query(ls,l,mid,L,R));
        if(R>mid) res=min(res,query(rs,mid+1,r,L,R));
        return res;
    }    
}S;

void dfs(int u,int f){
    a[++m]=u,pos[u]=m;
    for(int v:e[u])
        if(v!=f) dfs(v,u);
}

int d[N];

inline void apr(int l,int r){
    ++d[l],--d[r+1];
}

signed main(){
    freopen("nim.in","r",stdin);
    freopen("nim.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>x>>A>>B;
    for(int u,v,i=1;i<n;i++){
        cin>>u>>v;
        e[u].emplace_back(v);
        e[v].emplace_back(u);
    }
    if(A<=B) cout<<'1';
    else{
        dfs(x,0);
        S.build(1,1,n);
        apr(A+1,A+1);
        if(A+1>n) ans=min(ans,S.query(1,1,n,1,min(1+B,n)));
        for(int i=1;i<=n;i++){
            d[i]+=d[i-1];
            if(d[i]>0){
                if(max(1ll,i-B)<=i-1) ans=min(ans,S.query(1,1,n,max(1ll,i-B),i-1));
                apr(i+A,i+A+B);
                if(i+B+A>n){
                    int mnb=max(0ll,n+1-i-A);
                    if(i+mnb<=min(n,i+2*B)) ans=min(ans,S.query(1,1,n,i+mnb,min(n,i+2*B)));
                }
            }
        }
        cout<<ans;
    }
    return 0;
}